package com.changgou.search.listener;

import com.changgou.search.config.RabbitMQConfig;
import com.changgou.search.service.EsManagerService;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

//监听上架的商品导入到es索引库中
@Component
public class GoodsUpListener {
    @Autowired
    private EsManagerService esManagerService;
    @RabbitListener(queues = RabbitMQConfig.SEARCH_ADD_QUEUE)
    public void getMessage(String message){
        System.out.println("接收到的消息："+message);
        //查询
        esManagerService.importDataToESBySpuId(message);
    }
}
